home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / DSP4TEST.ZIP / TST3.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-01-02  |  982 b   |  72 lines

  1. ; generate FSK modulated sinewave on the left channel
  2.  
  3.     nolist
  4.     include 'leonid'
  5.     list
  6.  
  7.  
  8. buflen    equ    32
  9. f    equ    2000
  10. fs    equ    16000
  11.  
  12. ; two integrator sinewave generator
  13. sg    macro    store
  14.     move            x:store,a
  15.     move            x:store+1,b
  16.  
  17.     move     b,y0
  18.     mac    x0,y0,a
  19.     move     a,y0
  20.     mac    -x0,y0,b
  21.  
  22.     move            a,x:store
  23.     move            b,x:store+1
  24.     endm
  25.  
  26.  
  27.     org    p:user_code
  28.  
  29.     move            #buffer+2,r7
  30.     move            #buflen*4-1,m7
  31.  
  32.     move            #buffer,r2
  33.     move            #4,n2
  34.     move            #buflen*4-1,m2
  35.  
  36.     ctrlcd    1,r2,buflen,LINEI,0.0,0.0,LINEO|HEADP,0.0,0.0
  37.     move            (r2)+
  38.     opencd    fs/1000
  39.  
  40. ; wait for one sample
  41. loop    waitblk r2,buflen,1
  42.  
  43. ; then generate the sinewave
  44.     move            #6.2832*500.0/fs,x0
  45.     sg    sg1
  46.     move            #6.2832*f/fs,x0
  47.     add    x0,b
  48.     move    b,x0
  49.     sg    sg2
  50.  
  51. ; and output the generated sample
  52.     move            b,y:(r2)+n2
  53.  
  54.  
  55.     jmp    <loop
  56.  
  57.  
  58.     org    x:user_data
  59.  
  60. sg1    dc    0.04,0.04
  61. sg2    dc    0.2,0.2
  62.  
  63. buffer    dsm    buflen*4
  64.  
  65.  
  66.     org    y:user_data
  67.  
  68.     dsm    buflen*4
  69.  
  70.  
  71.     end
  72.